home *** CD-ROM | disk | FTP | other *** search
- /*
- GetTLE - Progress.c - Display a progress indicator
- Copyright ⌐2000 Andreas Schneider
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- #include <PalmOS.h>
- #include <unix_stdarg.h>
- #include "Progress.h"
- #include "GetTLERsc.h"
-
- // remove the progress indicator from the form
- extern void ClearProgress(void)
- {
- FormPtr Form=FrmGetActiveForm();
-
- // gotta do the Hide/Show stuff otherwise the text
- // won't be deleted
- FrmHideObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
- FrmCopyLabel(FrmGetActiveForm(),GetTLEMainStatusLabel,"");
- FrmShowObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
- return;
- }
-
- // Use to show progress
- extern void DisplayProgress(Boolean erase,Char *format,...)
- {
- va_list args;
- FormPtr Form=FrmGetActiveForm();
- Char text[50]="";
-
- // only hide and show the label if the text can shrink in length
- if (erase)
- {
- FrmHideObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
- }
- va_start(args,format);
- StrVPrintF(text,format,args);
- va_end();
- FrmCopyLabel(Form,GetTLEMainStatusLabel,text);
- if (erase)
- {
- FrmShowObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
- }
- return;
- }